home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWInk.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  4.7 KB  |  173 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWInk.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWINK_H
  11. #define FWINK_H
  12.  
  13. #ifndef FWGROBJ_H
  14. #include "FWGrObj.h"
  15. #endif
  16.  
  17. #ifndef FWGRGLOB_H
  18. #include "FWGrGlob.h"
  19. #endif
  20.  
  21. #ifndef FWGCONST_H
  22. #include "FWGConst.h"
  23. #endif
  24.  
  25. #ifndef FWCOLOR_H
  26. #include "FWColor.h"
  27. #endif
  28.  
  29. #if FW_LIB_EXPORT_PRAGMAS
  30. #pragma lib_export on
  31. #endif
  32.  
  33. //========================================================================================
  34. //    Forward Class Declarations
  35. //========================================================================================
  36.  
  37. class FW_CLASS_ATTR FW_CInkRep;
  38.  
  39. //========================================================================================
  40. //    CLASS FW_PInk
  41. //========================================================================================
  42.  
  43. class FW_CLASS_ATTR FW_PInk : public FW_CGraphicCountedPtr
  44. {
  45. public:
  46.     FW_DECLARE_CLASS
  47.  
  48. public:
  49.     FW_PInk();
  50.     virtual ~ FW_PInk();
  51.     
  52.     FW_PInk(const FW_CColor& foreColor, 
  53.             const FW_CColor& backColor = FW_kRGBWhite, 
  54.             FW_TransferModes tranferMode = FW_kCopy);
  55.     FW_PInk(FW_TransferModes tranferMode);
  56.  
  57.     FW_PInk(const FW_PInk& other);
  58.     FW_PInk& operator=(const FW_PInk& other);
  59.         
  60.     FW_PInk(FW_EStandardInks std);
  61.     FW_PInk& operator=(FW_EStandardInks std);
  62.         
  63.     FW_CInkRep* operator->();
  64.     const FW_CInkRep* operator->() const;
  65. };
  66.  
  67. //----------------------------------------------------------------------------------------
  68. //    FW_PInk::operator->
  69. //----------------------------------------------------------------------------------------
  70. inline FW_CInkRep* FW_PInk::operator->()
  71. {
  72.     return (FW_CInkRep*)GetRep();
  73. }
  74.  
  75. //----------------------------------------------------------------------------------------
  76. //    FW_PInk::operator->
  77. //----------------------------------------------------------------------------------------
  78. inline const FW_CInkRep* FW_PInk::operator->() const
  79. {
  80.     return (const FW_CInkRep*)GetRep();
  81. }
  82.  
  83. //========================================================================================
  84. //    class FW_CInkRep
  85. //========================================================================================
  86.  
  87. class FW_CLASS_ATTR FW_CInkRep : public FW_CGraphicCountedPtrRep
  88. {
  89.     friend class FW_CLASS_ATTR FW_PInk;
  90.  
  91. public:
  92.     FW_DECLARE_CLASS
  93.  
  94. //----------------------------------------------------------------------------------------
  95. //    Constructors/Destructors
  96. //
  97. public:
  98.     FW_CInkRep();    
  99.     FW_CInkRep(const FW_CColor& foreColor, const FW_CColor& backColor, FW_TransferModes transferMode);
  100.     FW_CInkRep(const FW_CInkRep& otherRep);
  101.     FW_CInkRep(FW_CReadableStream& archive);
  102.  
  103.     FW_CInkRep& operator=(const FW_CInkRep& otherRep);
  104.     
  105.     virtual ~FW_CInkRep();
  106.  
  107. //----------------------------------------------------------------------------------------
  108. //    Memory management
  109. //
  110. public:
  111.     void*                operator new(size_t size);
  112.     void                operator delete(void* p);
  113.  
  114. //----------------------------------------------------------------------------------------
  115. //    Inherited API
  116. //
  117. public:
  118.     virtual void        Flatten(FW_CWritableStream& archive) const;
  119.     
  120.     virtual FW_Boolean IsEqual(const FW_CGraphicCountedPtrRep* other) const;
  121.     
  122. //----------------------------------------------------------------------------------------
  123. //    New API
  124. //
  125. public:
  126.     // ----- Copying -----
  127.     FW_PInk                Copy() const;
  128.     
  129.     // ----- Archiving -----
  130.     static void*        Read(FW_CReadableStream& archive);
  131.     
  132.     // ----- Accessors -----
  133.     void                SetForeColor(const FW_CColor& foreColor)
  134.                             {fForeColor = foreColor;}
  135.     void                GetForeColor(FW_CColor& foreColor) const
  136.                             {foreColor = fForeColor;}
  137.     const FW_CColor*    GetForeColor() const
  138.                             {return &fForeColor;}
  139.     
  140.     void                SetBackColor(const FW_CColor& backColor)
  141.                             {fBackColor = backColor;}
  142.     void                GetBackColor(FW_CColor& backColor) const
  143.                             {backColor = fBackColor;}
  144.     const FW_CColor*    GetBackColor() const
  145.                             {return &fBackColor;}
  146.     
  147.     void                SetTransferMode(FW_TransferModes transferMode)
  148.                             {fTransferMode = transferMode;}
  149.     FW_TransferModes    GetTransferMode() const
  150.                             {return fTransferMode;}
  151.     
  152. //----------------------------------------------------------------------------------------
  153. //    Public but for internal use only
  154. //
  155. public:
  156.     FW_Boolean    PrivSpecialTransferMode() const
  157.                     {return fTransferMode == FW_kInvert || fTransferMode == FW_kErase;}
  158.     
  159. //----------------------------------------------------------------------------------------
  160. //    Data Members
  161. //
  162. private:
  163.     FW_CColor            fForeColor;
  164.     FW_CColor            fBackColor;
  165.     FW_TransferModes     fTransferMode;
  166. };
  167.  
  168. #if FW_LIB_EXPORT_PRAGMAS
  169. #pragma lib_export off
  170. #endif
  171.  
  172. #endif
  173.